const app = getApp()

Page({
  data: {
    txt: "分类",
    select: false,
    talks: []
  },
  //点击我显示底部弹出框
  clickme: function () {
    this.showModal();
  },
  // 分享
  onShareAppMessage: function (res) {
    // console.log(res);
    if (res.from === "shares") { }
    return {
      title: "哈哈",
      desc: "我是中国人",
      path: "pages/resume/click/purchase",
      imageUrl: "../../../images/gift6.png",
      success: function (res) {
        console.log("成功", res);

      }
    }
  },
  //显示对话框
  showModal: function () {
    // 显示遮罩层
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "linear",
      delay: 0
    })
    this.animation = animation
    animation.translateY(300).step()
    this.setData({
      animationData: animation.export(),
      showModalStatus: true
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export()
      })
    }.bind(this), 200)
  },
  //隐藏对话框
  hideModal: function () {
    // 隐藏遮罩层
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "linear",
      delay: 0
    })
    this.animation = animation
    animation.translateY(300).step()
    this.setData({
      animationData: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export(),
        showModalStatus: false
      })
    }.bind(this), 200)
  },

  bindShowMsg() {
    this.setData({
      select: !this.data.select,
      color: 'black'
    })
  },
  mySelect(e) {
    var name = e.currentTarget.dataset.name
    this.setData({
      txt: name,
      select: false
    })
  },
 
  imgGo: function () {
    wx.navigateTo({
      url: '../../member/head/head',
    })
  },

  // 点赞与否
  handle: function (e) {
    var that = this;
    var vid = that.data.vid;
    var vArr = that.data.vsrc;
    wx.request({
      method: 'POST',
      url: queryUrl + 'video/fav ',
      data: { userId: that.data.userId, videoId: vArr[vid].id },
      success: function (res) {
        console.log(res.data);
        wx.showToast({
          title: res.data.msg,
          icon: 'none'
        })
        vArr[vid].fav_state = res.data.data.fav;
        that.setData({ vsrc: vArr })
      }
    })
  },
  goSearch: function () {
    wx.navigateTo({
      url: '../../search/search',
    })
  }

})